<?php
$recorders = $this->recorders;
    $random   = '';
  for ($i=0; $i<6; $i++) { $d=rand(1,30)%2; $random .= ($d?chr(rand(65,90)):chr(rand(48,57))); }
?>

<script type="text/javascript">
  en4.core.runonce.add(function() {
    if( !$type(soundManager) || !$type(en4.music) ) {
      Asset.javascript('<?php echo $this->layout()->staticBaseUrl . 'externals/soundmanager/script/soundmanager2'
           . (APPLICATION_ENV == 'production' ? '-nodebug-jsmin' : '' ) . '.js' ?>');
      Asset.javascript('<?php echo $this->layout()->staticBaseUrl . 'application/modules/Recorder/externals/scripts/core.js' ?>');
      Asset.javascript('<?php echo $this->layout()->staticBaseUrl . 'application/modules/Recorder/externals/scripts/player.js' ?>');
    }

    en4.music.player.enablePlayers();
    
    en4.core.shutdown.add(function() {
      soundManager.stopAll();
    });
  });
</script>

<div class="music_player_wrapper" id="music_player_<?php echo $random ?>">

    <div class="music_player" <?php if (isset($this->id)) echo "id='{$this->id}'" ?> <?php if ($this->short_player): ?>style="display:none;"<?php endif; ?>>
      <div class="music_player_top">
        <div class="music_player_art">
          <img class="main item_photo_music_playlist item_nophoto " alt="Profile Playlist" src="<?php echo $this->baseUrl().'/application/modules/Recorder/externals/images/playlist.png'?>">
        </div>
        
        <div class="music_player_info">
          <div class="music_player_controls_wrapper">
            <div class="music_player_controls_right">
              <span class="music_player_button_launch_wrapper">
                <div class="music_player_button_launch_tooltip"><?php echo $this->translate('Pop-out Player') ?></div>
                  <a href="javascript:void(0);" class="music_player_button_launch"></a>
              </span>
            </div>
            <div class="music_player_controls_left">
              <span class="music_player_button_prev"></span>
              <span class="music_player_button_play"></span>
              <span class="music_player_button_next"></span>

              <div class="music_player_controls_volume">
                <span class="music_player_controls_volume_toggle"></span>
                <span class="music_player_controls_volume_bar"><span class="volume_bar_1"></span></span>
                <span class="music_player_controls_volume_bar"><span class="volume_bar_2"></span></span>
                <span class="music_player_controls_volume_bar"><span class="volume_bar_3"></span></span>
                <span class="music_player_controls_volume_bar"><span class="volume_bar_4"></span></span>
                <span class="music_player_controls_volume_bar"><span class="volume_bar_5"></span></span>
              </div>
            </div>
          </div>
          <div class="music_player_trackname"></div>
          <div class="music_player_scrub">
            <div class="music_player_scrub_cursor"></div>
            <div class="music_player_scrub_downloaded"></div>
          </div>
          <div class="music_player_time">
            <div class="music_player_time_elapsed"></div>
            <div class="music_player_time_total"></div>
          </div>
        </div>
      </div>
      
      
      <ul class="music_player_tracks playlist_1 ?>">

       <?php foreach( $recorders as $recorder ): if( !empty($recorder) ): ?>
        <li>
          <div class="music_player_tracks_add_wrapper">
            <div class="music_player_tracks_add_tooltip"><?php echo $this->translate('Add to my Playlist') ?></div>
            
          </div>
          <div class="music_player_tracks_name" title="<?php echo $recorder->getTitle() ?>">
            <?php echo $this->htmlLink($recorder->getFilePath(),
              $this->string()->truncate($recorder->getTitle(), 50),
              array(
                'class' => 'music_player_tracks_url',
                'type' => 'audio',
                'rel' => $recorder->recorder_id
            )) ?>
            <span class="music_player_tracks_plays">
              
            </span>

          </div>
        </li>
       <?php endif; endforeach; ?>


      </ul>
      
    </div>

    <?php if ($this->short_player): ?>
      <div class="music_player playlist_short_player">
        <div class="music_player_top">
          <div class="music_player_info">
            <div class="music_player_controls_wrapper">
              <div class="music_player_controls_left">
                <span class="music_player_button_play"></span>
                <div class="playlist_short_player_title">
                  <?php if (!empty($recorders) && !empty($recorders[0])) echo $recorders[0]->getTitle() ?>
                </div>
                <div class="playlist_short_player_tracks">
                  <?php $recorderCount = count($recorders); ?>
                  <?php echo $this->translate(array("%s track", "%s tracks", $recorderCount), $this->locale()->toNumber($recorderCount)) ?>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    <?php endif; ?>

   
  
</div>